package org.shiro.demo.entity;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="m_order")
public class ManagerOrder {
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date dealTime;
	
	/** 下单时的备注 */
	@Column(name = "description")
	private String description;
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id")
	/** 主键 */
	private long id;
	
	/**
	 * 总价
	 */
	private double money;

	@OneToMany(cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE }, fetch = FetchType.LAZY, mappedBy = "managerOrder")
	private Set<ManagerOrderDetail> orderDetails;

	@ManyToOne
	@JoinColumn(name = "prop_id")
	private OrderProp orderProp;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date postTime;
	
	/**
	 * 对应的交易id号码
	 */
	private String trade_no;
	
	@ManyToOne
	@JoinColumn(name = "user_id")
	/** 下单的用户 */
	private Administrator user;
	private String uuid;

	public Date getDealTime() {
		return dealTime;
	}
	
	public String getDescription() {
		return description;
	}

	public long getId() {
		return id;
	}

	public double getMoney() {
		return money;
	}

	public Set<ManagerOrderDetail> getOrderDetails() {
		return orderDetails;
	}

	public OrderProp getOrderProp() {
		return orderProp;
	}

	public Date getPostTime() {
		return postTime;
	}

	public String getTrade_no() {
		return trade_no;
	}


	public Administrator getUser() {
		return user;
	}

	public void setUser(Administrator user) {
		this.user = user;
	}

	public String getUuid() {
		return uuid;
	}

	public void setDealTime(Date dealTime) {
		this.dealTime = dealTime;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setId(long id) {
		this.id = id;
	}

	public void setMoney(double money) {
		this.money = money;
	}

	public void setOrderDetails(Set<ManagerOrderDetail> orderDetails) {
		this.orderDetails = orderDetails;
	}

	public void setOrderProp(OrderProp orderProp) {
		this.orderProp = orderProp;
	}

	public void setPostTime(Date postTime) {
		this.postTime = postTime;
	}

	public void setTrade_no(String trade_no) {
		this.trade_no = trade_no;
	}

	

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}
	
	
}
